<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
>


<!-- 导入公有的header -->
<head th:include="common/head::header"/>


<body class="hold-transition skin-blue sidebar-mini">


<!-- DataTables -->
<script th:src="@{/plug-in/adminLTE/plugins/datatables/jquery.dataTables.min.js}"></script>
<script th:src="@{/plug-in/adminLTE/plugins/datatables/dataTables.bootstrap.min.js}"></script>




    <!-- =============================================== -->
    <!-- Main content -->
    <section class="content">

        <div class="row">

            <div class="col-md-12">
                <!-- PRODUCT LIST -->
                    <div class="box-header with-border">
                        <div class="input-group input-group-sm">
                            <input type="text" class="form-control" placeholder="待开发完善..." readonly="readonly">
                            <span class="input-group-btn">
                                      <button type="button" class="btn btn-info btn-flat" disabled="disabled">Search</button>
                            </span>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <ul class="products-list product-list-in-box">

                            <!-- item -->
                            <li class="item" th:each="file,rowIndex: ${fileList} ">
                                <div class="product-img">
                                    <img th:src="@{'/plug-in/adminLTE/dist/img/'+${file.icoName} }" alt="文件类型图片">
                                </div>
                                <div class="product-info" >
                                    <!-- 编号 -->
                                    <span th:if="${rowIndex.first==false && rowIndex.last==false}"><small class="badge bg-green" th:text="${rowIndex.index}"></small></span>

                                    <a href="javascript:void(0)" th:onclick="openFile([[${file.filePathCode}]]);" class="product-title" th:if="${file.fileIs==true}">
                                        <span style="font-size: 12px;" th:text="${file.fileName}"></span>
                                        <span class="label label-success pull-right" th:text="${file.fileSize}"></span>
                                    </a>
                                    <a th:href="@{'/jm/manager/fileBrower/index?path=' +${file.filePathCode} }"  class="product-title" th:if="${file.fileIs==false}">
                                        <span  th:text="${file.fileName}"></span>
                                    </a>
                                    <div class="product-description"  th:text="${file.filePath}"></div>

                                </div>
                                <!-- 如果是文件操作工具条 -->
                                <div class="product-info" >
                                    <table width="100%">
                                        <tr>
                                            <td class="has-warning" style="vertical-align: bottom">
                                                <label th:if="${file.fileIs==true}" class="control-label" ><i class="fa fa-clock-o"></i> <span th:text="${file.lastUpdateDateTime}"></span></label>
                                            </td>
                                            <td align="right" width="110">
                                                <button type="button" th:if="${file.fileIs==true}" class="btn btn-info btn-xs" th:onclick="openFile([[${file.filePathCode}]]);"><i class="fa fa-play-circle"></i>Play</button>
                                                <button type="button" th:if="${isAlowDeleteFile==true && rowIndex.first==false && rowIndex.last==false}" class="btn btn-danger btn-xs" th:onclick="deleteFile([[${file.filePathCode}]]);"><i class="fa fa-remove"></i>Delete</button>
                                            </td>
                                        </tr>
                                    </table>

                               </div>
                            </li>
                            <!-- /.item -->
                        </ul>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer text-center">
                    </div>
                    <!-- /.box-footer -->
                </div>
                <!-- /.box -->
            <!-- /.col -->
        </div>
    </section>


    <!-- /.content -->
    <script type="application/javascript">
        //打开文件
        function openFile(filePath){
            var urlStr = ctxPath + '/jm/manager/fileBrower/openFile';
            jQuery.ajax({
                url: urlStr,
                type: "POST",
                dataType:'json',//接受数据格式
                data:{filePath:filePath},   //要传递的数据
                async: false,
                success: function(data){
                    if(data.data==true){
                        window.parent.$.dialog.tips('打开成功');
                    }else{
                        window.parent.alertError('打开失败！');
                    }
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    window.parent.alertError('打开执行异常！');
                }
            });
        }
        //删除文件
        function deleteFile(filePath){
           window.parent.$.dialog.confirm('你确定要执行[删除此文件]吗？', function(){
                var urlStr = ctxPath + '/jm/manager/fileBrower/deleteFile';
                jQuery.ajax({
                    url: urlStr,
                    type: "POST",
                    dataType:'json',//接受数据格式
                    data:{filePath:filePath},   //要传递的数据
                    async: false,
                    success: function(data){
                        if(data.data==true){
                            window.location.reload();
                            window.parent.alertSuccess('删除成功');
                        }else{
                            window.parent.alertError('删除失败！');
                        }
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        window.parent.alertError('删除执行异常！');
                    }
                });
            }, function(){
               window.parent.$.dialog.tips('执行取消操作');
            });
        }
        //下载文件
        function dlFile(filePath){
            window.parent.alertWarning("未实现");
        }
    </script>
</body>
</html>
